package com.mofang.powerdekorhelper.adapter;

import android.content.Context;

import com.mofang.powerdekorhelper.R;
import com.mofang.powerdekorhelper.base.recycleview.BaseRecycleViewAdapter;
import com.mofang.powerdekorhelper.base.recycleview.BaseViewHolder;
import com.mofang.powerdekorhelper.model.NewsInfo;

import java.util.List;

/**
 * Created by luofei on 2017/7/21 0021.
 */

public class NewsInfoAdapter extends BaseRecycleViewAdapter {

    public NewsInfoAdapter(List<?> data, Context mContext, int layoutId) {
        super(data, mContext, layoutId);
    }

    @Override
    protected <T> void convert(BaseViewHolder holder, T bean, int position) {

        NewsInfo.Data data = (NewsInfo.Data) bean;
        holder.setText(R.id.news_info_list_item_title, data.getTitle());
        holder.setText(R.id.news_info_list_item_time, data.getArticle_createTime1());
        holder.setText(R.id.news_info_list_item_seen_time, data.getSeen_time() + "");

        holder.setImage(R.id.news_info_list_item_imv, data.getImage(), R.mipmap.list_defaut_bg);

        holder.itemView.setTag(data);
    }

    public void addData(List<NewsInfo.Data> datas) {
        mData.addAll(datas);
        notifyDataSetChanged();
    }
}
